package ru.javadevelop.homefinans;

import android.app.Application;
import ru.javadevelop.homefinans.common.DB;

/**
 * http://t-menu.ru
 * User: navff
 * Date: 18.07.12
 * Time: 5:53
 */
public class ExtApplication extends Application {
    private static ExtApplication instatce;

    public static ExtApplication getInstatce()
    {
        return instatce;
    }
    //************************************************************
    // Глобальные параметры
    public static final  String setting1 = "Value of seting 1";
    //************************************************************
//    public DbAdapter dbAdapter;
    @Override
    public final void onCreate()
    {
        super.onCreate();
        instatce = this;

//        String dbUrl = "jdbc:h2:mem:";
        String dbUrl = String.format("jdbc:h2:%s/database", getFilesDir().getAbsolutePath());
        DB.INSTANCE.openConnection(dbUrl, "sa", "sa");
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        DB.INSTANCE.closeConnection();
    }
}
